USE [SRD]
GO

/****** Object:  Table [dbo].[EMPRESA]    Script Date: 05/15/2011 14:24:50 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[EMPRESA](
	[EMPRESA_ID] [int] IDENTITY(1,1) NOT NULL,
	[RASAO_SOCIAL] [nvarchar](60) NOT NULL,
	[NOME_FANTASIA] [nvarchar](50) NOT NULL,
	[CNPJ] [nvarchar](14) NOT NULL,
	[EMAIL] [nvarchar](50) NOT NULL,
	[CEP] [nvarchar](8) NOT NULL,
	[LOUGRADOURO] [nvarchar](50) NOT NULL,
	[NUMERO] [nvarchar](10) NOT NULL,
	[COMPLEMENTO] [nvarchar](30),
	[CIDADE] [nvarchar](30) NOT NULL,
	[ESTADO] [nvarchar](2) NOT NULL,
	[TELEFONE] [nvarchar](10) NOT NULL,
	[FAX] [nvarchar](10),
	[END_SMTP] [nvarchar](50) NULL,
	[USER_SMTP] [nvarchar](50) NULL,
	[SENHA_SMTP] [nvarchar](20) NULL,
 CONSTRAINT [PK_EMPRESA] PRIMARY KEY CLUSTERED 
(
	[EMPRESA_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO


***************************************************************************************

USE [SRD]
GO

/****** Object:  Table [dbo].[CARGO]    Script Date: 05/14/2011 10:45:47 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[CARGO](
	[CARGO_ID] [int] IDENTITY(1,1) NOT NULL,
	[NM_CARGO] [nvarchar](30) NOT NULL,
	[ATIVO] [char](1) NOT NULL,
	[EMPRESA_ID] [int] NULL,
 CONSTRAINT [PK_CARGO] PRIMARY KEY CLUSTERED 
(
	[CARGO_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO


*****************************************************************************************

USE [SRD]
GO

/****** Object:  Table [dbo].[EMPRESA_CARGO]    Script Date: 05/14/2011 10:50:12 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[EMPRESA_CARGO](
	[EMPRESA_CARGO_ID] [int] IDENTITY(1,1) NOT NULL,
	[EMPRESA_ID] [int] NOT NULL,
	[CARGO_ID] [int] NOT NULL,
 CONSTRAINT [PK_EMPRESA_CARGO] PRIMARY KEY CLUSTERED 
(
	[EMPRESA_CARGO_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[EMPRESA_CARGO]  WITH CHECK ADD  CONSTRAINT [FK_EMPRESA_CARGO_CARGO] FOREIGN KEY([CARGO_ID])
REFERENCES [dbo].[CARGO] ([CARGO_ID])
GO

ALTER TABLE [dbo].[EMPRESA_CARGO] CHECK CONSTRAINT [FK_EMPRESA_CARGO_CARGO]
GO

ALTER TABLE [dbo].[EMPRESA_CARGO]  WITH CHECK ADD  CONSTRAINT [FK_EMPRESA_CARGO_EMPRESA] FOREIGN KEY([EMPRESA_ID])
REFERENCES [dbo].[EMPRESA] ([EMPRESA_ID])
GO

ALTER TABLE [dbo].[EMPRESA_CARGO] CHECK CONSTRAINT [FK_EMPRESA_CARGO_EMPRESA]
GO


*****************************************************************************************


USE [SRD]
GO

/****** Object:  Table [dbo].[SETOR]    Script Date: 05/14/2011 10:54:25 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[SETOR](
	[SETOR_ID] [int] IDENTITY(1,1) NOT NULL,
	[NM_SETOR] [nvarchar](25) NOT NULL,
	[ATIVO] [char](1) NOT NULL,
	[EMPRESA_ID] [int] NOT NULL,
 CONSTRAINT [PK_SETOR] PRIMARY KEY CLUSTERED 
(
	[SETOR_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[SETOR]  WITH CHECK ADD  CONSTRAINT [FK_SETOR_EMPRESA] FOREIGN KEY([EMPRESA_ID])
REFERENCES [dbo].[EMPRESA] ([EMPRESA_ID])
GO

ALTER TABLE [dbo].[SETOR] CHECK CONSTRAINT [FK_SETOR_EMPRESA]
GO



*****************************************************************************************


USE [SRD]
GO

/****** Object:  Table [dbo].[TIPO_DESPESA]    Script Date: 05/14/2011 10:55:17 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[TIPO_DESPESA](
	[TIPO_DESPESA_ID] [int] IDENTITY(1,1) NOT NULL,
	[NM_TIPO_DESPESA] [nvarchar](20) NOT NULL,
	[PAI_ID] [int] NOT NULL,
	[ATIVO] [char](1) NOT NULL,
 CONSTRAINT [PK_TIPO_DESPESA] PRIMARY KEY CLUSTERED 
(
	[TIPO_DESPESA_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO



*****************************************************************************************


USE [SRD]
GO

/****** Object:  Table [dbo].[TIPO_PASSAGEM_AEREA]    Script Date: 05/14/2011 10:58:47 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[TIPO_PASSAGEM_AEREA](
	[TIPO_PASSAGEM_AEREA_ID] [int] IDENTITY(1,1) NOT NULL,
	[DESCRICAO] [nvarchar](30) NOT NULL,
 CONSTRAINT [PK_TIPO_PASSAGEM_AEREA] PRIMARY KEY CLUSTERED 
(
	[TIPO_PASSAGEM_AEREA_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO



*****************************************************************************************



USE [SRD]
GO

/****** Object:  Table [dbo].[STATUS_SUBMISSAO]    Script Date: 05/14/2011 10:59:19 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[STATUS_SUBMISSAO](
	[STATUS_SUBMISSAO_ID] [int] IDENTITY(1,1) NOT NULL,
	[DESCRICAO] [nvarchar](15) NOT NULL,
	[ATIVO] [char](1) NOT NULL,
	[EMPRESA_ID] [int] NOT NULL,
 CONSTRAINT [PK_STATUS_SUBMISSAO] PRIMARY KEY CLUSTERED 
(
	[STATUS_SUBMISSAO_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[STATUS_SUBMISSAO]  WITH CHECK ADD  CONSTRAINT [FK_STATUS_SUBMISSAO_EMPRESA] FOREIGN KEY([EMPRESA_ID])
REFERENCES [dbo].[EMPRESA] ([EMPRESA_ID])
GO

ALTER TABLE [dbo].[STATUS_SUBMISSAO] CHECK CONSTRAINT [FK_STATUS_SUBMISSAO_EMPRESA]
GO



*****************************************************************************************




USE [SRD]
GO

/****** Object:  Table [dbo].[CENTRO_CUSTO]    Script Date: 05/14/2011 10:59:48 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[CENTRO_CUSTO](
	[CENTRO_CUSTO_ID] [int] IDENTITY(1,1) NOT NULL,
	[NM_CENTRO_CUSTO] [nvarchar](30) NOT NULL,
	[ATIVO] [char](1) NOT NULL,
	[EMPRESA_ID] [int] NOT NULL,
 CONSTRAINT [PK_CENTRO_CUSTO] PRIMARY KEY CLUSTERED 
(
	[CENTRO_CUSTO_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[CENTRO_CUSTO]  WITH CHECK ADD  CONSTRAINT [FK_CENTRO_CUSTO_EMPRESA] FOREIGN KEY([EMPRESA_ID])
REFERENCES [dbo].[EMPRESA] ([EMPRESA_ID])
GO

ALTER TABLE [dbo].[CENTRO_CUSTO] CHECK CONSTRAINT [FK_CENTRO_CUSTO_EMPRESA]
GO



*****************************************************************************************



USE [SRD]
GO

/****** Object:  Table [dbo].[PROFISSIONAL]    Script Date: 05/14/2011 11:00:15 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[PROFISSIONAL](
	[PROFISSIONAL_ID] [int] IDENTITY(1,1) NOT NULL,
	[NM_PROFISSIONAL] [nvarchar](70) NOT NULL,
	[CPF] [nvarchar](11) NOT NULL,
	[RG] [nvarchar](20) NULL,
	[EMAIL] [nvarchar](50) NOT NULL,
	[LOGIN] [nvarchar](30) NOT NULL,
	[SENHA] [nvarchar](10) NOT NULL,
	[EMPRESA_ID] [int] NOT NULL,
	[CARGO_ID] [int] NOT NULL,
	[SETOR_ID] [int] NOT NULL,
	[LIDER_ID] [int] NOT NULL,
	[ATIVO] [char](1) NOT NULL,
 CONSTRAINT [PK_PROFISSIONAL] PRIMARY KEY CLUSTERED 
(
	[PROFISSIONAL_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[PROFISSIONAL]  WITH CHECK ADD  CONSTRAINT [FK_PROFISSIONAL_CARGO] FOREIGN KEY([CARGO_ID])
REFERENCES [dbo].[CARGO] ([CARGO_ID])
GO

ALTER TABLE [dbo].[PROFISSIONAL] CHECK CONSTRAINT [FK_PROFISSIONAL_CARGO]
GO

ALTER TABLE [dbo].[PROFISSIONAL]  WITH CHECK ADD  CONSTRAINT [FK_PROFISSIONAL_EMPRESA] FOREIGN KEY([EMPRESA_ID])
REFERENCES [dbo].[EMPRESA] ([EMPRESA_ID])
GO

ALTER TABLE [dbo].[PROFISSIONAL] CHECK CONSTRAINT [FK_PROFISSIONAL_EMPRESA]
GO

ALTER TABLE [dbo].[PROFISSIONAL]  WITH CHECK ADD  CONSTRAINT [FK_PROFISSIONAL_SETOR] FOREIGN KEY([SETOR_ID])
REFERENCES [dbo].[SETOR] ([SETOR_ID])
GO

ALTER TABLE [dbo].[PROFISSIONAL] CHECK CONSTRAINT [FK_PROFISSIONAL_SETOR]
GO



*****************************************************************************************




USE [SRD]
GO

/****** Object:  Table [dbo].[PROJETO]    Script Date: 05/14/2011 11:00:45 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[PROJETO](
	[PROJETO_ID] [int] IDENTITY(1,1) NOT NULL,
	[NM_PROJETO] [nvarchar](30) NOT NULL,
	[EMPRESA_ID] [int] NOT NULL,
	[CENTRO_CUSTO_ID] [int] NOT NULL,
	[LIDER_ID] [int] NOT NULL,
	[ATIVO] [char](1) NOT NULL,
 CONSTRAINT [PK_PROJETO] PRIMARY KEY CLUSTERED 
(
	[PROJETO_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[PROJETO]  WITH CHECK ADD  CONSTRAINT [FK_PROJETO_CENTRO_CUSTO] FOREIGN KEY([CENTRO_CUSTO_ID])
REFERENCES [dbo].[CENTRO_CUSTO] ([CENTRO_CUSTO_ID])
GO

ALTER TABLE [dbo].[PROJETO] CHECK CONSTRAINT [FK_PROJETO_CENTRO_CUSTO]
GO

ALTER TABLE [dbo].[PROJETO]  WITH CHECK ADD  CONSTRAINT [FK_PROJETO_EMPRESA] FOREIGN KEY([EMPRESA_ID])
REFERENCES [dbo].[EMPRESA] ([EMPRESA_ID])
GO

ALTER TABLE [dbo].[PROJETO] CHECK CONSTRAINT [FK_PROJETO_EMPRESA]
GO

ALTER TABLE [dbo].[PROJETO]  WITH CHECK ADD  CONSTRAINT [FK_PROJETO_PROFISSIONAL] FOREIGN KEY([LIDER_ID])
REFERENCES [dbo].[PROFISSIONAL] ([PROFISSIONAL_ID])
GO

ALTER TABLE [dbo].[PROJETO] CHECK CONSTRAINT [FK_PROJETO_PROFISSIONAL]
GO



*****************************************************************************************



USE [SRD]
GO

/****** Object:  Table [dbo].[SUBMISSAO]    Script Date: 05/14/2011 11:01:13 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[SUBMISSAO](
	[SUBMISSAO_ID] [int] IDENTITY(1,1) NOT NULL,
	[DESCRICAO] [nvarchar](70) NOT NULL,
	[DATA] [datetime] NOT NULL,
	[EMPRESA_ID] [int] NOT NULL,
	[PROFISSIONAL_ID] [int] NOT NULL,
	[PROJETO_ID] [int] NOT NULL,
	[STATUS_SUBMISSAO_ID] [int] NOT NULL,
 CONSTRAINT [PK_SUBMISSAO] PRIMARY KEY CLUSTERED 
(
	[SUBMISSAO_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[SUBMISSAO]  WITH CHECK ADD  CONSTRAINT [FK_SUBMISSAO_EMPRESA] FOREIGN KEY([EMPRESA_ID])
REFERENCES [dbo].[EMPRESA] ([EMPRESA_ID])
GO

ALTER TABLE [dbo].[SUBMISSAO] CHECK CONSTRAINT [FK_SUBMISSAO_EMPRESA]
GO

ALTER TABLE [dbo].[SUBMISSAO]  WITH CHECK ADD  CONSTRAINT [FK_SUBMISSAO_PROFISSIONAL] FOREIGN KEY([PROFISSIONAL_ID])
REFERENCES [dbo].[PROFISSIONAL] ([PROFISSIONAL_ID])
GO

ALTER TABLE [dbo].[SUBMISSAO] CHECK CONSTRAINT [FK_SUBMISSAO_PROFISSIONAL]
GO

ALTER TABLE [dbo].[SUBMISSAO]  WITH CHECK ADD  CONSTRAINT [FK_SUBMISSAO_PROJETO] FOREIGN KEY([PROJETO_ID])
REFERENCES [dbo].[PROJETO] ([PROJETO_ID])
GO

ALTER TABLE [dbo].[SUBMISSAO] CHECK CONSTRAINT [FK_SUBMISSAO_PROJETO]
GO

ALTER TABLE [dbo].[SUBMISSAO]  WITH CHECK ADD  CONSTRAINT [FK_SUBMISSAO_STATUS_SUBMISSAO] FOREIGN KEY([STATUS_SUBMISSAO_ID])
REFERENCES [dbo].[STATUS_SUBMISSAO] ([STATUS_SUBMISSAO_ID])
GO

ALTER TABLE [dbo].[SUBMISSAO] CHECK CONSTRAINT [FK_SUBMISSAO_STATUS_SUBMISSAO]
GO


*****************************************************************************************




USE [SRD]
GO

/****** Object:  Table [dbo].[DESPESA]    Script Date: 05/14/2011 11:01:44 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[DESPESA](
	[DESPESA_ID] [int] IDENTITY(1,1) NOT NULL,
	[DESCRICAO] [nvarchar](50) NOT NULL,
	[VALOR] [float] NOT NULL,
	[TIPO_DESPESA_ID] [int] NOT NULL,
	[SUBMISSAO_ID] [int] NOT NULL,
 CONSTRAINT [PK_DESPESA] PRIMARY KEY CLUSTERED 
(
	[DESPESA_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[DESPESA]  WITH CHECK ADD  CONSTRAINT [FK_DESPESA_SUBMISSAO] FOREIGN KEY([SUBMISSAO_ID])
REFERENCES [dbo].[SUBMISSAO] ([SUBMISSAO_ID])
GO

ALTER TABLE [dbo].[DESPESA] CHECK CONSTRAINT [FK_DESPESA_SUBMISSAO]
GO

ALTER TABLE [dbo].[DESPESA]  WITH CHECK ADD  CONSTRAINT [FK_DESPESA_TIPO_DESPESA] FOREIGN KEY([TIPO_DESPESA_ID])
REFERENCES [dbo].[TIPO_DESPESA] ([TIPO_DESPESA_ID])
GO

ALTER TABLE [dbo].[DESPESA] CHECK CONSTRAINT [FK_DESPESA_TIPO_DESPESA]
GO


*****************************************************************************************




USE [SRD]
GO

/****** Object:  Table [dbo].[DESPESA_COMUNICACAO]    Script Date: 05/14/2011 11:02:27 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[DESPESA_COMUNICACAO](
	[DESPESA_ID] [int] NOT NULL,
	[DATA] [datetime] NOT NULL,
	[NM_PRESTADOR] [nvarchar](30) NOT NULL,
 CONSTRAINT [PK_DESPESA_COMUNICACAO] PRIMARY KEY CLUSTERED 
(
	[DESPESA_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[DESPESA_COMUNICACAO]  WITH CHECK ADD  CONSTRAINT [FK_DESPESA_COMUNICACAO_DESPESA] FOREIGN KEY([DESPESA_ID])
REFERENCES [dbo].[DESPESA] ([DESPESA_ID])
GO

ALTER TABLE [dbo].[DESPESA_COMUNICACAO] CHECK CONSTRAINT [FK_DESPESA_COMUNICACAO_DESPESA]
GO



*****************************************************************************************




USE [SRD]
GO

/****** Object:  Table [dbo].[DESPESA_HOSPEDAGEM]    Script Date: 05/14/2011 11:02:51 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[DESPESA_HOSPEDAGEM](
	[DESPESA_ID] [int] NOT NULL,
	[CHECKIN] [datetime] NOT NULL,
	[CHECKOUT] [datetime] NOT NULL,
	[VALOR_DIARIA] [decimal](5, 2) NOT NULL,
	[NM_PRESTADOR] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_DESPESA_HOSPEDAGEM] PRIMARY KEY CLUSTERED 
(
	[DESPESA_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[DESPESA_HOSPEDAGEM]  WITH CHECK ADD  CONSTRAINT [FK_DESPESA_HOSPEDAGEM_DESPESA] FOREIGN KEY([DESPESA_ID])
REFERENCES [dbo].[DESPESA] ([DESPESA_ID])
GO

ALTER TABLE [dbo].[DESPESA_HOSPEDAGEM] CHECK CONSTRAINT [FK_DESPESA_HOSPEDAGEM_DESPESA]
GO


*****************************************************************************************



USE [SRD]
GO

/****** Object:  Table [dbo].[DESPESA_KM]    Script Date: 05/14/2011 11:03:15 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[DESPESA_KM](
	[DESPESA_ID] [int] NOT NULL,
	[ORIGEM] [nvarchar](30) NOT NULL,
	[DESTINO] [nvarchar](30) NOT NULL,
	[KM] [int] NOT NULL,
	[DATA] [datetime] NOT NULL,
 CONSTRAINT [PK_DESPESA_KM] PRIMARY KEY CLUSTERED 
(
	[DESPESA_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[DESPESA_KM]  WITH CHECK ADD  CONSTRAINT [FK_DESPESA_KM_DESPESA] FOREIGN KEY([DESPESA_ID])
REFERENCES [dbo].[DESPESA] ([DESPESA_ID])
GO

ALTER TABLE [dbo].[DESPESA_KM] CHECK CONSTRAINT [FK_DESPESA_KM_DESPESA]
GO


*****************************************************************************************



USE [SRD]
GO

/****** Object:  Table [dbo].[DESPESA_PASSAGEM_AEREA]    Script Date: 05/14/2011 11:03:41 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[DESPESA_PASSAGEM_AEREA](
	[DESPESA_ID] [int] NOT NULL,
	[ETICKET] [nvarchar](15) NOT NULL,
	[DATA] [datetime] NOT NULL,
	[ORIGEM] [nvarchar](30) NOT NULL,
	[DESTINO] [nvarchar](30) NOT NULL,
	[NM_PRESTADOR] [nvarchar](30) NOT NULL,
	[TIPO_PASSAGEM_AEREA_ID] [int] NOT NULL,
 CONSTRAINT [PK_DESPESA_PASSAGEM_AEREA] PRIMARY KEY CLUSTERED 
(
	[DESPESA_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[DESPESA_PASSAGEM_AEREA]  WITH CHECK ADD  CONSTRAINT [FK_DESPESA_PASSAGEM_AEREA_DESPESA] FOREIGN KEY([DESPESA_ID])
REFERENCES [dbo].[DESPESA] ([DESPESA_ID])
GO

ALTER TABLE [dbo].[DESPESA_PASSAGEM_AEREA] CHECK CONSTRAINT [FK_DESPESA_PASSAGEM_AEREA_DESPESA]
GO

ALTER TABLE [dbo].[DESPESA_PASSAGEM_AEREA]  WITH CHECK ADD  CONSTRAINT [FK_DESPESA_PASSAGEM_AEREA_TIPO_PASSAGEM_AEREA] FOREIGN KEY([TIPO_PASSAGEM_AEREA_ID])
REFERENCES [dbo].[TIPO_PASSAGEM_AEREA] ([TIPO_PASSAGEM_AEREA_ID])
GO

ALTER TABLE [dbo].[DESPESA_PASSAGEM_AEREA] CHECK CONSTRAINT [FK_DESPESA_PASSAGEM_AEREA_TIPO_PASSAGEM_AEREA]
GO


*****************************************************************************************



USE [SRD]
GO

/****** Object:  Table [dbo].[DESPESA_TRANSPORTE_PUBLICO]    Script Date: 05/14/2011 11:03:57 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[DESPESA_TRANSPORTE_PUBLICO](
	[DESPESA_ID] [int] NOT NULL,
	[DATA] [datetime] NOT NULL,
	[ORIGEM] [nvarchar](30) NOT NULL,
	[DESTINO] [nvarchar](30) NOT NULL,
 CONSTRAINT [PK_DESPESA_TRANSPORTE_PUBLICO] PRIMARY KEY CLUSTERED 
(
	[DESPESA_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[DESPESA_TRANSPORTE_PUBLICO]  WITH CHECK ADD  CONSTRAINT [FK_DESPESA_TRANSPORTE_PUBLICO_DESPESA] FOREIGN KEY([DESPESA_ID])
REFERENCES [dbo].[DESPESA] ([DESPESA_ID])
GO

ALTER TABLE [dbo].[DESPESA_TRANSPORTE_PUBLICO] CHECK CONSTRAINT [FK_DESPESA_TRANSPORTE_PUBLICO_DESPESA]
GO


